<template>
  <el-config-provider :locale="locale">
    <router-view />
  </el-config-provider>
</template>

<script setup lang="ts">
import useLocale from '@/hooks/locale'
import { computed } from 'vue'
import zhCN from 'element-plus/dist/locale/zh-cn'
import enUS from 'element-plus/dist/locale/en'

const { currentLocale } = useLocale()
const locale = computed(() => {
  switch (currentLocale.value) {
    case 'zh-CN':
      return zhCN
    case 'en-US':
      return enUS
    default:
      return enUS
  }
})
</script>

<style scoped></style>
